/* static/css/style.css */

/* 重置默认样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f6f7;
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 导航栏 */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}
.logo {
    color: #6a11cb;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.4rem;
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 15px;
}
.nav-links a {
    margin: 0 15px;
    text-decoration: none;
    color: #333;
    font-weight: 500;
    transition: color 0.3s;
}
.nav-links a:hover {
    color: #6a11cb;
}
.nav-links a.nav-link.active {
    color: #6a11cb;
    font-weight: 600;
    border-bottom: 2px solid #6a11cb;
    padding-bottom: 2px;
}

.welcome-text {
    color: #6a11cb;
    font-weight: 500;
    margin-right: 10px;
}

/* 主内容区 */
.main-content {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* 广场页头部 */
.plaza-header {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    padding: 40px 0;
    margin-bottom: 30px;
}

.plaza-header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    text-align: center;
    color: white;
}

.plaza-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.plaza-subtitle {
    font-size: 1.2rem;
    margin-bottom: 30px;
    opacity: 0.9;
}

/* 搜索框 */
.search-container {
    max-width: 600px;
    margin: 0 auto;
}

.search-form {
    display: flex;
    gap: 10px;
}

.search-input {
    flex: 1;
    padding: 15px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.search-btn {
    padding: 15px 25px;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-btn:hover {
    background: #ff5252;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* 广场容器 */
.plaza-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 精选内容区域 */
.featured-section {
    margin-bottom: 40px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
}

.more-link {
    text-decoration: none;
    color: #6a11cb;
    font-weight: 500;
    transition: color 0.3s;
}

.more-link:hover {
    color: #2575fc;
}

/* 故事网格 */
.stories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 20px;
}

/* 故事卡片 */
.story-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s;
}

.story-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

.story-image {
    position: relative;
    padding-top: 80%; /* 5:4 aspect ratio */
    overflow: hidden;
}

.story-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.story-card:hover .story-image img {
    transform: scale(1.05);
}

.story-content {
    padding: 16px;
}

.story-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.story-author {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 12px;
}

.story-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.story-category {
    background: #f0f2f5;
    color: #666;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
}

.stories-container .story-excerpt {
    color: #666;
    line-height: 1.5;
    margin-bottom: 15px;
}

.story-stats {
    display: flex;
    gap: 10px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #999;
    font-size: 0.9rem;
}

.stat-item svg {
    width: 16px;
    height: 16px;
}

/* 音频故事卡片 */
.audio-stories {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.audio-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
}

.audio-card .story-image {
    padding-top: 0;
    width: 72px;
    height: 72px;
    border-radius: 8px;
    overflow: hidden;
}

.audio-card .story-content {
    flex: 1;
    padding: 0;
}

.audio-card .story-title {
    font-size: 1rem;
    margin-bottom: 4px;
}

.audio-card .story-author {
    font-size: 0.85rem;
    margin-bottom: 0;
}

.audio-duration {
    font-size: 0.9rem;
    color: #999;
    white-space: nowrap;
}

/* 图片创作卡片 */
.image-stories {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.image-card {
    border-radius: 8px;
}

.image-card .story-image {
    padding-top: 100%; /* 1:1 aspect ratio */
}

/* 保持原有的分类标签切换样式 */
.tabs-container {
    margin-bottom: 30px;
}

.tabs {
    display: flex;
    list-style: none;
    border-bottom: 2px solid #eee;
    flex-wrap: wrap;
}

.tab {
    padding: 12px 20px;
    cursor: pointer;
    font-weight: 500;
    color: #666;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
}

.tab:hover {
    color: #6a11cb;
}

.tab.active {
    color: #6a11cb;
    border-bottom: 3px solid #6a11cb;
}

/* 保持原有的故事容器样式 */
.stories-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

/* 保持原有的故事卡片样式 */
.stories-container .story-card {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    transition: transform 0.3s;
}

.stories-container .story-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.stories-container .story-card h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.story-excerpt {
    color: #666;
    line-height: 1.5;
    margin-bottom: 15px;
}

.stories-container .story-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #999;
}

.category {
    background: #6a11cb;
    color: white;
    padding: 3px 8px;
    border-radius: 15px;
    font-size: 0.8rem;
}

.no-stories {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #666;
}

/* 分页器样式 */
.pagination-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 30px;
    gap: 15px;
}

.pagination {
    display: flex;
    list-style: none;
    gap: 5px;
}

.pagination-info {
    color: #666;
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 15px;
}

.page-item {
    display: inline-block;
}

.page-link {
    display: block;
    padding: 10px 15px;
    background: #f8f9fa;
    color: #333;
    text-decoration: none;
    border-radius: 5px;
    transition: all 0.3s;
}

.page-link:hover {
    background: #e9ecef;
    color: #6a11cb;
}

.page-item.active .page-link {
    background: #6a11cb;
    color: white;
}

.page-item.disabled .page-link {
    color: #6c757d;
    cursor: not-allowed;
}

/* 按钮通用样式 */
.btn {
    display: inline-block;
    padding: 12px 24px;
    background: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    width: 100%;
}
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    background: #0056b3;
}

.btn:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #6c757d;
}

.btn-secondary:hover {
    background: #5a6268;
}

/* 表单通用样式 */
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border 0.3s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

/* 认证页面样式 */
.auth-container {
    max-width: 500px;
    margin: 40px auto;
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.auth-container h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #6a11cb;
}

.auth-form {
    margin-bottom: 20px;
}

.auth-switch {
    text-align: center;
    margin-top: 20px;
}

.auth-switch a {
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
}

.auth-switch a:hover {
    text-decoration: underline;
}

/* 消息提示样式 */
.message {
    padding: 12px;
    margin-bottom: 20px;
    border-radius: 8px;
    text-align: center;
    display: none;
}

.message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* 故事生成页面样式 */
.story-form {
    max-width: 600px;
    margin: 0 auto 30px;
}

.story-result {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    display: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.story-result h2 {
    color: #6a11cb;
    margin-bottom: 15px;
}

.story-result p {
    line-height: 1.6;
    margin-bottom: 20px;
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 0.9rem;
    margin-top: auto;
    background: rgba(255, 255, 255, 0.8);
    border-top: 1px solid #eee;
}

/* 加载动画 */
.loading {
    text-align: center;
    color: #666;
    font-style: italic;
    margin: 20px 0;
    display: none;
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: #007bff;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        height: auto;
        padding: 10px;
    }
    
    .nav-links {
        margin-top: 10px;
    }
    
    .nav-links a {
        margin: 0 10px;
        font-size: 0.9rem;
    }
    
    .plaza-header {
        padding: 30px 0;
    }
    
    .plaza-title {
        font-size: 2rem;
    }
    
    .plaza-subtitle {
        font-size: 1rem;
    }
    
    .search-form {
        flex-direction: column;
    }
    
    .stories-grid {
        grid-template-columns: repeat(auto-fill, minmax(100%, 1fr));
        gap: 16px;
    }
    
    .audio-stories {
        grid-template-columns: repeat(auto-fill, minmax(100%, 1fr));
    }
    
    .image-stories {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    
    .auth-container {
        margin: 20px 10px;
        padding: 20px;
    }
    
    .pagination {
        flex-wrap: wrap;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .stories-container {
        grid-template-columns: 1fr;
    }
}